#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <numeric>
using namespace std;

int main()
{
        int n, m;
        cin >> n >> m;
        int ans = 2 * n * (m - 1) + (n - 1) * m;

        for(;;){
                int x1, y1, x2, y2;
                cin >> x1 >> y1 >> x2 >> y2;
                if(x1 == x2){
                        ans -= 1;
                }else{
                        ans -= 2;
                }
                cout<<ans<<endl;
        }
        return 0;
}